from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget, QLabel
from PyQt5.QtGui import QPalette
from PyQt5.QtCore import Qt
import sys

class label_application(QWidget):
    def __init__(self):
        super(label_application, self).__init__()
        self.gui_init()

    def gui_init(self):
        label1 = QLabel(self)
        label2 = QLabel(self)
        label3 = QLabel(self)
        label4 = QLabel(self)

        palette = QPalette()
        # palette.setColor(QPalette.Window, Qt.black)
        palette.setColor(QPalette.WindowText, Qt.white)
        label1.setPalette(palette)
        label1.setText("<h2>Hallo World</h2>")
        # 下面是设置字体以及颜色的代码
        # label1.setStyleSheet("background-color: Black")
        # label1.setStyleSheet("QLabel{color:rgb(225,255,255,255);font-size:50px;font-weight:normal;font-family:Arial;}")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    my_gui = label_application()
    my_gui.show()
    sys.exit(app.exec_())